package com.wn.service;

import com.wn.service.controller.WorkProduct3;
import com.wn.service.controller.WorkProduct4;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author yellow Docter
 * @date 2022 -08-31
 * @desc
 */
@SpringBootTest
public class RabbitMqTest02 {

    @Autowired
    private WorkProduct3 workProduct3;

    @Test
    public void demo03(){

//        workProduct3.sendMsg("中了500w 告诉所有的人..");
        workProduct3.sendMsg("一起看电影<<建国大业>>..");

    }

    @Autowired
    private WorkProduct4 workProduct4;

    @Test
    public void demo04_directSendMsg(){

        workProduct4.sendMsg("direct-log","info","项目正常启动");
        workProduct4.sendMsg("direct-log","error","项目连接数据库失败");
        workProduct4.sendMsg("direct-log","warn","网络有点慢");
        workProduct4.sendMsg("direct-log","info","项目上线了");

    }

    @Test
    public void demo05_topicSendMsg(){

        workProduct4.sendMsg("exchange-topic","info.orange.hello","我去Q1");
        workProduct4.sendMsg("exchange-topic","error.ab.rabbit","我去Q2");
        workProduct4.sendMsg("exchange-topic","error.rabbit","我哪里也不去");

        workProduct4.sendMsg("exchange-topic","lazy.ab","我去Q2");
        workProduct4.sendMsg("exchange-topic","lazy.ab.abc","我去Q2");

        workProduct4.sendMsg("exchange-topic","lazy.orange.aa","我去Q1Q2");
        workProduct4.sendMsg("exchange-topic","lazy.hello.rabbit","我去Q2");

    }

}
